import { QuitCommand } from "@swda/configs/params"

Scene_Title.prototype.createCommandWindow = function () {
    this._commandWindow = new Window_TitleCommand();
    this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this));
    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
    this._commandWindow.setHandler('options', this.commandOptions.bind(this));
    if (Utils.isNwjs()) {
        this._commandWindow.setHandler('quit', this.commandQuit.bind(this));
    }
    this.addWindow(this._commandWindow);
};

Scene_Title.prototype.commandQuit = function () {
    const nw = require("nw.gui")
    nw.App.quit()
}

const _Window_TitleCommand_makeCommandList = Window_TitleCommand.prototype.makeCommandList
Window_TitleCommand.prototype.makeCommandList = function () {
    _Window_TitleCommand_makeCommandList.call(this)
    if (Utils.isNwjs()) {
        this.addCommand(QuitCommand.text, 'quit');
    }
};